#include <iostream>
#include <string>
#include <set>
using namespace std;

int main() {
    int n = 0;
    while (cin >> n)
    {
        set<string> array;
        string id, opert;
        int count = 0;
        for (int i = 0; i < n; i++)
        {
            cin >> id >> opert;
            if (opert == "connect") array.insert(id);
            else if (opert == "disconnect") array.erase(id);
            int size = array.size();
            count = size > count ? size : count;
        }
        cout << count << endl;
    }
}